package com.kevin.utility.common;


/**
 * HTML代码工具
 * 
 * @author juntao.lai
 * @since 2015年2月12日
 *
 */
public class HtmlCodeUtil {
    
    public final static String table = "table";
    public final static String thead = "thead";
    public final static String tbody = "tbody";
    public final static String tr = "tr";
    public final static String th = "th";
    public final static String td = "td";
    public final static String p = "p";
    public final static String space = "&nbsp;";
    public final static String br = "br";
    
    public static String getTagBegin(String tag, String cs){
        if (!StringUtil.isNullOrEmpty(cs)){
            return String.format("<%s %s>", tag, cs);
        } else {
            return String.format("<%s>", tag);
        }
    }
    
    public static String getTagBegin(String tag){
        return getTagBegin(tag, null);
    }
    
    public static String getTagEnd(String tag){
        return String.format("</%s>", tag);
    }
    
    public static String getTag(String tag){
        return String.format("<%s />", tag);
    }
    
    
    public static String getInputText(String id,String value){
    	return String.format("<input type='text' id='%s' name='%s' value='%s'>",id, id,value);
    }
    public static String getHiddenInputText(String id, String value){
    	return String.format("<input type='hidden' id='%s' name='%s' value='%s' >",id, id,value);
    }
    public static String getBeginSelectText(String id, String eventJs){
		return String.format("<select id='%s' name='%s' class='chosen' data-placeholder='' data-with-diselect='1' %s>", id, id, eventJs);
    } 
    public static String getEndSelectText(){
		return String.format("</select>");
    } 
    public static String getOptionText(String id, String value){
		return String.format("<option value='%s' >%s</option>", id, value);
    } 
    public static String getDateInputText(String id, String value){
    	return String.format("<input id='%s' type='text' readonly='readonly' value='%s' class='Wdate'  onClick='WdatePicker()' ></input>", id,value);
    }
    public static String getDateInputText(String id, String onclick,String value){
    	return String.format("<input id='%s' type='text' readonly='readonly'  value='%s' class='Wdate' onClick=&quot;%s&quot; ></input>", id,value,onclick);
    }
    public static void main(String[] args){
    }
}
